<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePartnersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('partners', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('agent_id')->index()->comment('代理人 ID');
            $table->tinyInteger('level')->default(1)->comment('合伙人等级; 1:有限合伙人 2:邀约合伙人');

            $table->unsignedBigInteger('performance')->default(0)->comment('业绩 单位分');
            $table->unsignedBigInteger('number_of_order')->default(0)->comment('订单数');
            $table->unsignedBigInteger('reward')->default(0)->comment('奖励 单位分');
            $table->unsignedBigInteger('income')->default(0)->comment('收入 单位分');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('partners');
    }
}
